package com.ming.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 主题交换机配置
 */
@Configuration
public class TopicConfiguration {
    @Bean
    public TopicExchange topicExchange() {
        return ExchangeBuilder.topicExchange("mt.topic2").durable(true).build();
    }

    @Bean
    public Queue topicQueue3() {
        return QueueBuilder.durable("topic.queue3").build();
    }

    @Bean
    public Binding topicBinding3_1() {
        return BindingBuilder.bind(topicQueue3()).to(topicExchange()).with("china.#");
    }

    @Bean
    public Binding topicBinding3_2() {
        return BindingBuilder.bind(topicQueue3()).to(topicExchange()).with("#.news");
    }
}
